<template>
	<el-button
		ref="btn"
		type="primary"
		icon="el-icon-search"
		:loading="loading"
		:size="size"
		@click="onClickEvent"
	></el-button>
</template>
<script>
    import { throttle } from '../../../utils/jk/jk-tool';
    export default {
        name: 'JkSearchButton',
        props: {
            loading: {
                type: Boolean,
                default: false
            },
            size: {
                type: String,
                default: 'small'
            }
        },
        data() {
            return {
                name: ''
            };
        },
        mounted() {
            this.$nextTick(() => {
                this.$refs.btn.$el.onkeydown = (e) => {
                    const _key = window.event.keyCode;
                    // 13 回车 32 空格
                    if (_key === 13 || _key === 32) {
                        return false;
                    }
                };
            });
        },
        methods: {
            onClickEvent: throttle((e, _this) => {
                _this.$emit('click');
            }, 1000)
        }

    };
</script>
